package com.example.service;


import com.example.entity.OrderSort;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

// 订单优先级服务
@Service
@Slf4j
public class OrderPriorityService {
    
    public int determineOrderPriority(OrderSort order) {
        int priority = 1; // 默认最低优先级
        
        // 根据客户类型确定基础优先级
        switch (order.getCustomerType()) {
            case "VIP":
                priority = 5;
                break;
            case "商家":
                priority = 7;
                break;
        }
        
        // 根据订单类型调整优先级
        switch (order.getOrderType()) {
            case "紧急":
                priority += 3;
                break;
            case "故障":
                priority = 10; // 最高优先级
                break;
        }
        
        // 金额大于10000的订单增加优先级
        if (order.getAmount() > 10000) {
            priority += 1;
        }
        
        // 确保优先级不超过最大值
        return Math.min(priority, 10);
    }
}




